﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PatientList.aspx.cs" Inherits="Page_AutoUpdate_PatientList" %>

<%@ Import Namespace="System.Data" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <link href="../../CSS/my-order.1.css" rel="stylesheet" />
    <script src="../../Scripts/WebForms/Common.js"></script>
    <link href="../../CSS/m.css" rel="stylesheet" />
    <link href="../../CSS/MyTest.css" rel="stylesheet" />
    <script src="../../Scripts/jquery-1.8.0.min.js"></script>
    <title>患者列表</title>
    <style>
        .table_data_details tbody tr th, td
        {
            height: auto;
            width: 64px;
            font-size: 12px;
            text-align: center;
                color: grey;
        }
    </style>
</head>
<body>
    <ul class="tab-list clearfix">
        <li id="btall" class="sort at" state="0">医嘱处理</li>
        <li class="sort" state="1">病历</li>
        <li class="sort" state="2">待定</li>
        <li class="sort" state="3">待定</li>
        <li class="more">
            <p class="cover"><span>更多</span></p>
            <div class="more-list" style="display: none;">
                <p state="4">待定</p>
            </div>
        </li>
    </ul>
    <section class="jump_patient_select">
        <table class="table_data_details">
            <colgroup>
                <col width="10%">
                <col width="10%">
                <col width="21%">
                <col width="10%">
                <col width="40%">
            </colgroup>
            <tbody>
            </tbody>
        </table>
    </section>
     <div class="noneDate" style="text-align: center; margin-top: 30%; display:none;" >
        <p>还没有任何病人~</p>
    </div>
    <script type="text/javascript">
        var state = "";
        $(".tab-list .sort").on("click", function () {
            var that = $(this);
            $(".tab-list li").removeClass("at");
            $(".tab-list .more p span").html("更多");
            that.addClass("at");
            state = that.attr("state");
            $(".more-list p").removeClass("at");
            $(".more-list").hide();
            console.log(state);

        });

        $(".tab-list .more").on("click", function () {
            var box = $(".more-list");
            if (box.is(":hidden")) {
                box.show();
            } else {
                box.hide();
            }
        });

        $(".more-list p").on("click", function () {
            $(".more-list p").removeClass("at");
            $(".tab-list li").removeClass("at");

            $(".tab-list .more").addClass("at");
            $(".tab-list .more p span").html($(this).html());

            $(this).addClass("at");


        })
        $().ready(function () {
            GetList();

        });
        function GetList() {
            $.post("/Handler/AutoUpdateHandler.ashx?action=PatientList", { WSID: '<%=wsid%>', KEY: '<%=key%>' }, function (data) {
                if (data == "" || typeof (eval("(" + data + ")").List) == "undefined") {
                    $(".noneDate").show();
                    $(".jump_patient_select").hide();
                } else {
                    var html = "";
                    var allTr = "";
                    var list = eval("(" + data + ")").List;
                    if (typeof (list) != "undefined") {
                        var temp = '<tr>'
                                        + '<th>房号</th>'
                                        + '<th>床位</th>'
                                        + '<th>患者姓名</th>'
                                        + '<th>性别</th>'
                                        + '<th>入住时间</th>'
                                    + 'tr';


                        for (var i = 0; i < list.length; i++) {
                            var link = "DoctorsTreat.aspx?SerialNumber=" + list[i].SERIALNUMBER + "&KEY=<%=UnicodeKey%>";
                            var childTemp = '<tr onclick="window.location.href=' + "'" + '' + link + '' + "'" + ';">'
                                            + '<td>{roomnum}</td>'
                                            + '<td>{beddes}</td>'
                                            + '<td>{patiname}</td>'
                                            + '<td>{sexname}</td>'
                                            + '<td>{admitDate}</td>'
                                          + '</tr>';

                            allTr += childTemp.replace(/{testNo}/, list[i].trowno)
                                .replace(/{roomnum}/, list[i].ROOMNUM)
                                .replace(/{beddes}/, list[i].BEDDES)
                                .replace(/{patiname}/, list[i].PATINAME)
                                .replace(/{sexname}/, list[i].SEXNAME)
                                .replace(/{admitDate}/, list[i].AdmitDate);
                        }
                        html = temp + allTr;
                        $(".table_data_details tbody").append(html);
                        $(".jump_patient_select").show();
                    }
                }
            });
        }
    </script>
</body>
</html>
